<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:p="http://primefaces.org/ui"
      xmlns:f="http://java.sun.com/jsf/core">

    <ui:composition template="layout.xhtml">
        <ui:define name="body">

            <h:form id="userForm" enctype="multipart/form-data">
                <h1 class="title">
                    <a href="#" class="back" onclick="history.go(-1)"/>
                    Usuário
                </h1>
                <p:messages id="messages" showDetail="true" autoUpdate="true"  /> 
                <div class="row">
                    <div class="twelve columns"> 
                        <fieldset>
                            <legend> <h4 style="margin:0 0 10px 0">Cadastro</h4></legend>
                            <p:panel id="userPanel" style="background: none; border: none;" 
                                     styleClass="container_24 clearfix ">

                                <p:outputLabel value="Nome: " styleClass="grid_3"/>
                                <p:inputText styleClass="grid_20" value="#{managerCreateUser.user.name}" />


                            </p:panel>

                        </fieldset>

                        <fieldset>
                            <legend> <h4 style="margin:0 0 10px 0">Login</h4></legend>
                            <p:panel id="loginPanel" style="background: none; border: none;" 
                                     styleClass="container_24 clearfix ">
                                <p:outputLabel value="Login: " styleClass="grid_3"/>
                                <p:inputText styleClass="grid_6" value="#{managerCreateUser.user.login}" />
                                <div class="clear"/>
                                <p:outputLabel value="Senha: " styleClass="grid_3"/>
                                <p:password  styleClass="grid_6" feedback="true" strongLabel="Forte"
                                             promptLabel="Digite a Senha"
                                             weakLabel="Fácil" goodLabel="Boa"   value="#{managerCreateUser.user.password}" />
                                <div class="clear"/>
                                <p:outputLabel value="Senha: " styleClass="grid_3"/>
                                <p:password  styleClass="grid_6" feedback="true" value="#{managerCreateUser.confirm}" 
                                             promptLabel="Digite a Senha"
                                             weakLabel="Fácil" goodLabel="Boa" strongLabel="Forte"/>
                            </p:panel>
                        </fieldset>
                        <fieldset>
                            <legend> <h4 style="margin:0 0 10px 0">Nível de Acesso</h4></legend>

                            <p:panel id="acessoPanel" style="background: none; border: none;" styleClass="container_24 clearfix ">

                                <p:pickList id="pickList" value="#{managerCreateUser.dualGrupo}" var="g" 
                                            converter="groupconverter" 
                                            itemLabel="#{g.name}" itemValue="#{g}" 
                                            showSourceFilter="true" showTargetFilter="true" 
                                            filterMatchMode="contains" style="width: 95%; ">  

                                    <f:facet name="sourceCaption">Disponíveis</f:facet>  
                                    <f:facet name="targetCaption">Selecionados</f:facet>  

                                </p:pickList>

                            </p:panel>
                        </fieldset>
                        <br/>
                        <div class="buttonAction">
                            <p:commandButton value="Salvar" icon="ui-icon-disk"
                                             update="@form"
                                             actionListener="#{managerCreateUser.save()}"
                                             styleClass="ui-priority-primary" />
                            <p:button href="indexuser.xhtml" value="Cancelar"  icon="ui-icon-trash" />
                        </div >
                    </div>
                </div>
            </h:form>
        </ui:define>
    </ui:composition>

</html>
